﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace VSHT.com.amall.controller
{
    public class DataController
    {
        public Form1 Form1 { get; set; }
        public authorization author;

        //界面消息弹框
        public void showMsg(string text)
        {
            MessageBox.Show(text);
        }
        //注册视频通话
        public void callReg(string callId, string callIp)
        {
            Form1.Reg(callId, callIp);
        }
        //拨打视频通话
        public void callDevice(string username)
        {
            Form1.callDevice(username);
        }
        //获取
        public bool getVeinShow()
        {
            return Form1.fingerShow();
        }
        //获取
        public void ddd()
        {
        }
        //开始指静脉采集
        public void fingerVein(string id)
        {
            Form1.fingerVein(id);
        }
        //开始指静脉验证
        public VienApi.ApiResult verifyVein()
        {
            return Form1.ValidateVein();
        }

        //删除指静脉
        public uint delFvuser(string id)
        {
            uint ifv = 1;
            if (uint.TryParse(id, out ifv))
            {
                // 转换成功，uintValue 现在包含转换后的无符号整数值
                Console.WriteLine("转换成功，无符号整数值为: " + ifv);
                return Form1.delFvuser(ifv);
            }
            else
            {
                // 转换失败，处理错误情况
                Console.WriteLine("转换失败，输入字符串不是有效的无符号整数。");
                return 1;   
            }
          
        }

        //指静脉采集停止
        public bool fingerEnd()
        {
            return Form1.fingerEnd();
        }

        //退出
        public void endcx()
        {
            Form1.endcx();
        }
        public void sent()
        {
            Form1.sent();
        }
        public Boolean opnefinf()
        {
           return Form1.open_fingerprint();
        }
        public int getsn()
        {
           return Form1.getSN();
        }
        public Boolean delfing(int id , int endId)
        {
           return Form1.delFing(id, endId);
        }
        public void verifyfingerprint(int type)
        {
            Form1.ManageThread(type);
        }
        public void regfing(int type)
        {
            Form1.ManageThread(type);
        }
        public void endreg()
        {
            Form1.StopRecordFingerPrint();
        }
        public void loadchar(int id)
        {
            Form1.loadChar(id);
        }
        public Boolean tongbu(string val ,int code)
        {
            return Form1.SetFingerPrintFeature(val , code); ;
        }
        public void zdh_()
        {
             Form1.zdh(); ;
        }
        public void hy_()
        {
            Form1.hy(); ;
        }
        public void zxh_()
        {
            Form1.zxh(); ;
        }
        public void gb_()
        {
            Form1.gb(); ;
        }
        public void cs_()
        {
            
        }
        //授权
        public void auth(string paramter)
        {
            paramter = "{\"total\":1,\"rows\":[{\"approveTime\":\"2024 - 02 - 01T13: 54:00.000 + 08:00\",\"authorizationResult\":\"true\",\"codes\": \"1\",\"content\": \"编号:008 名称:梁队长申请打开库房:库房1\",\"createBy\": nu11,\"createTime\":\"2024 -02-01 13:53:46\",\"deptId\": \"101\",\"deptName\":“东莞支队\",\"deviceserialno\": \"HNZK202302251411\",\"devicename\":\"库房1\",\"endUserId\": \"008\",\"enduserName\": \"编号:008 名称:梁队长\",\"hourTime\": \" - 1\",\"id\": 248,\"params\":{ },\"remark\": null,\"status\": 0,\"sy\": \"训练\",\"type\": 1,\"updateBy\": nu11, \"updateTime\": nu11}],\"status\":0，\"msg\":\"查询成功\"}";
            if (author == null)
            {
                author = new authorization(paramter);
            }
            author.Show();
            author.BringToFront();
        }
    }
}
